/*
 *  LED -- simple LED support
 *
 *  $Id: led.h,v 1.7 2007/11/27 15:15:14 joel Exp $
 */

#ifndef __LED_h
#define __LED_h

#define __LONG_LED

#include <stdio.h>

#if defined(__LONG_LED)

#define __LED_PRINTING 1
#define LED_ON()  fputs( "LED ON\n", stderr )
#define LED_OFF() fputs( "LED OFF\n", stderr )

#elif defined(mbx860)

#define MBX_LED_REG *((volatile unsigned char *)0xfa100001)

#define LED_ON()  MBX_LED_REG = 0x0F
#define LED_OFF() MBX_LED_REG = 0x00

#elif defined(icecube)

#include <mpc5200.h>

#define LED_INIT() \
  do { \
    mpc5200.gpiosen |= 0x30000000; \
    mpc5200.gpiosdd |= 0x30000000; \
  } while (0)

#define LED_ON() \
  do { \
    mpc5200.gpiosdo |= 0x30000000; \
  } while (0)

#define LED_OFF() \
  do { \
    mpc5200.gpiosdo &= ~0x30000000; \
  } while (0)

#else

/* some real hardware stuff might go here */
#error "no definition was tripped"

#endif

#ifndef LED_INIT
#define LED_INIT() 
#endif

#endif
